#include <unitree/robot/go2/sport/sport_client.hpp>
#include <unistd.h>
#include <iostream>
#include <string>

int main(int argc, char **argv)
{
    if (argc < 2)
    {
        std::cout << "Usage: " << argv[0] << " actionName" << std::endl;
        std::cout << "Available actions: Sit, Hello, Stretch, Heart, Scrape, RecoveryStand" << std::endl;
        return -1;
    }

    std::string network_interface = "eth0";
    std::string action = argv[1];

    unitree::robot::ChannelFactory::Instance()->Init(0, network_interface);

    unitree::robot::go2::SportClient sport_client;
    sport_client.SetTimeout(10.0f);
    sport_client.Init();

    if (action == "Sit")
    {
        /* 坐下 */
        sport_client.Sit();
    }
    else if (action == "Hello")
    {
        /* 打招呼 */
        sport_client.Hello();
    }
    else if (action == "Stretch")
    {
        /* 伸懒腰 */
        sport_client.Stretch();
    }
    else if (action == "Heart")
    {
        /* 比心 */
        sport_client.Heart();
    }
    else if (action == "Scrape")
    {
        /* 作揖 */
        sport_client.Scrape();
    }
    else if(action == "RecoveryStand")
    {
        /* 恢复站立 */
        sport_client.RecoveryStand();
    }
    else
    {
        std::cout << "Unknown action: " << action << std::endl;
        return -1;
    }

    std::cout << "done" << std::endl;

    return 0;
}
